package com.godofgamblers.hotelmanagementsystem.service.imp;

import com.godofgamblers.hotelmanagementsystem.mapper.Room_typeMapper;
import com.godofgamblers.hotelmanagementsystem.pojo.Room;
import com.godofgamblers.hotelmanagementsystem.pojo.Room_Type;
import com.godofgamblers.hotelmanagementsystem.service.Room_TypeService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author: 伴你时光尽头
 * @Date: 2019/10/15 15:03
 */
@Service
@Data
public class Room_TypeServiceImp implements Room_TypeService {
    @Autowired
    private Room_typeMapper room_typeMapper;//自动装配

    /**
     * 查询：
     * 查询所有的表单项
     *
     * @return List<Room_Type>
     */
    @Override
    public List<Room_Type> showAllItem() {
        return room_typeMapper.showAllItem();
    }

    @Override
    public void changeOneItem_Discount(Room_Type room_type) {
        room_typeMapper.changeOneItem_Discount(room_type);
    }

    @Override
    public void changeOneItem(Room_Type room_type) {
        room_typeMapper.changeOneItem(room_type);
    }

    @Override
    public void changeAllItem_Discount(BigDecimal room_type_discount) {
        room_typeMapper.changeAllItem_Discount(room_type_discount);
    }

    /**
     * 根据id查找房间类型名称
     *
     * @param room_type_id
     * @return
     */
    @Override
    public String selectRoomTypeNameById(Integer room_type_id) {
        return room_typeMapper.selectRoomTypeNameById(room_type_id);
    }

    /**
     * 增加库存
     * 根据room中的属性room_type_id来确定哪个类型的房间库存增加
     *
     * @param room
     */
    @Override
    public void addStockById(Room room) {
        room_typeMapper.addStockById(room);
    }

    /**
     * 减少库存
     * 根据room中的属性room_type_id来确定哪个类型的房间库存减少
     *
     * @param room
     */
    @Override
    public void reduceStockById(Room room) {
        room_typeMapper.reduceStockById(room);
    }

    @Override
    public String findRoomTypeName(Integer room_type_id) {
        return room_typeMapper.findRoomTypeName(room_type_id);
    }
}
